import Vue from 'vue'
import VueRouter from 'vue-router'
import Index from '../views/Index.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Index',
    component: Index,
    redirect: 'login',
    children: [
      {
        path: 'files',
        name: 'Files',
        component: () => import('@/views/files/Index.vue')
      },
      {
        path: 'collects',
        name: 'Collects',
        component: () => import('@/views/collects/Index.vue')
      },
      {
        path: 'shares',
        name: 'Shares',
        component: () => import('@/views/shares/Index.vue')
      },
      {
        path: 'trashes',
        name: 'Trashes',
        component: () => import('@/views/trashes/Index.vue')
      }
    ]
  },
  {
    path: '/login',
    name: 'Login',
    component: () => import('@/views/Login.vue')
  },
  {
    path: '/register',
    name: 'Register',
    component: () => import('@/views/Register.vue')
  }
]

const router = new VueRouter({
  routes
})

export default router
